﻿using System.Text;
using System.Text.Json;

namespace Nasty.Core.SuperExtension
{
    public static class StringExtension
    { 
        // 带可选参数的重载
        public static IConfiguration BuildConfigurationFromJson(this string jsonString)
        {
            using (var memoryStream = new MemoryStream(Encoding.UTF8.GetBytes(jsonString)))
            {
                return new ConfigurationBuilder()
                    .AddJsonStream(memoryStream)
                    .Build();
            }
        }
    }
}
